package com.yuexun.dhdoctor.module.meeting.model.impl;

import com.yuexun.dhdoctor.base.BaseEntity;
import com.yuexun.dhdoctor.module.meeting.api.MeetingApi;
import com.yuexun.dhdoctor.module.meeting.bean.MeetingBean;
import com.yuexun.dhdoctor.module.meeting.bean.MeetingSignData;
import com.yuexun.dhdoctor.module.meeting.model.IMeetingModel;
import com.yuexun.dhdoctor.util.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by work-jx on 2016/11/15.
 */
public class MeetingModel implements IMeetingModel {
    private MeetingApi api;

    public MeetingApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(MeetingApi.class);
        }
    }

    @Override
    public Observable<MeetingBean> getMeetingList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getMeetingList(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingSignData>> getMeetingSign(Map<String, String> praise) {
        api = ApiInstance();
        return api.getMeetingSign(praise);
    }
}
